package cn.tedu.shoot;

import java.awt.Graphics;
import java.awt.image.BufferedImage;

import javax.imageio.ImageIO;

/**图片工具类*/
public class Images {
	public static BufferedImage[] airplanes;
	public static BufferedImage[] bigairplanes;
	public static BufferedImage[] bees;
	public static BufferedImage bullet;
	public static BufferedImage bossbullet;
	public static BufferedImage bulletboss;
	public static BufferedImage[] background;
	public static BufferedImage[] heros;
	public static BufferedImage heros1;
	public static BufferedImage heros2;
	public static BufferedImage[] hero;
	public static BufferedImage hero1;
	public static BufferedImage hero2;
	public static BufferedImage[] bosshero;
	public static BufferedImage[] bloods;
	public static BufferedImage gameover;
	public static BufferedImage[] pause;
	public static BufferedImage[] start;
	public static BufferedImage[] choos;
	public static BufferedImage warning;
	static {
		background = new BufferedImage[2];
		background[0] = readImage("/imgs/background1.png");
		background[1] = readImage("/imgs/background2.png");
		warning = readImage("/imgs/warning.png");
		start = new BufferedImage[6];
		pause = new BufferedImage[3];
		for(int i=0;i<start.length;i++){
			start[i] = readImage("/imgs/start"+(i+1)+".png");
		}
		pause[0] = readImage("/imgs/pause0.png");
		pause[1] = readImage("/imgs/pause1.png");
		pause[2] = readImage("/imgs/pause2.png");
		gameover = readImage("/imgs/gameover2.png");
		bullet = readImage("/imgs/bullet1.png");
		bossbullet = readImage("/imgs/bossbullet1.png");
		bulletboss = readImage("/imgs/bossbullet2.png");
		choos = new BufferedImage[5];
		for(int i=0;i<choos.length;i++){
			choos[i] = readImage("/imgs/choos"+i+".png");
		}
		
		bosshero = new BufferedImage[6];
		hero = new BufferedImage[6];
		heros = new BufferedImage[2];
		
			heros[0] = readImage("/imgs/hero01.png");
			heros[1] = readImage("/imgs/hero02.png");
			hero[0] = readImage("/imgs/hero.png");
			hero[1] = readImage("/imgs/hero1.png");
			
			heros1 = readImage("/imgs/hero03.png");
			hero1 = readImage("/imgs/hero04.png");
			
			heros2 = readImage("/imgs/hero06.png");
			hero2 = readImage("/imgs/hero05.png");
			
		bosshero[0] = readImage("/imgs/boss3.png") ;
		bosshero[1] = readImage("/imgs/boss3.png") ;
		for(int i=2;i<hero.length;i++) {
			hero[i] = readImage("/imgs/bom"+(i-1)+".png");
			bosshero[i] = readImage("/imgs/bom"+(i-1)+".png");
		}
		
		
		airplanes = new BufferedImage[5];
		bigairplanes = new BufferedImage[5];
		bees = new BufferedImage[5];
		airplanes[0] = readImage("/imgs/airplane0.png");
		bigairplanes[0] = readImage("/imgs/bigairplane0.png");
		bees[0] = readImage("/imgs/bee0.png");
		for(int i=1;i<airplanes.length;i++) {
			airplanes[i] = readImage("/imgs/bom"+i+".png");
			bigairplanes[i] = readImage("/imgs/bom"+i+".png");
			bees[i] = readImage("/imgs/bom"+i+".png");
		}
		bloods = new BufferedImage[6];
		bloods[0] = readImage("/imgs/blood6.png");
		for(int i=1;i<bloods.length;i++){
			bloods[i] = readImage("/imgs/blood"+(6-i)+".png");
		}
		
	}
	public static Graphics getGraphics(){
		Graphics g = gameover.getGraphics();
		return g;
	}
	/**读取图片*/
	public static BufferedImage readImage(String fileName) {
		try{
			BufferedImage img = ImageIO.read(FlyingObject.class.getResource(fileName));
			return img;
		}catch(Exception e){
			e.printStackTrace();
			throw new RuntimeException();
		}
	}
}
